package zoo.animals.birds;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import zoo.animals.birds.Ducks.FlyWithWings;
import zoo.animals.birds.Ducks.Flyable;
import zoo.food.Food;
import zoo.food.Corn;

/**
 * Created with IntelliJ IDEA.
 * User: platonovv
 * Date: 25.11.13
  * To change this template use File | Settings | File Templates.
 */
public abstract class Duck extends Bird {
    private static final Log log = LogFactory.getLog(Bird.class);
    private Flyable flyBehaivor;
    public Duck(String name, int age) {
        super(name, age);
        flyBehaivor = new FlyWithWings();
    }

    @Override
    public boolean isFlying() {
        return true;
    }
    public Object wing() throws Exception{
        return null;
    }
    public void voice() {
        log.info("krya krya");
    }
    abstract public void fly();
    public void feed(Food food) throws Exception {
        if (!(food instanceof Corn))
            throw new IllegalArgumentException("Ducks desires Corn!");
        voice();
    }
}
